package devcontainer

import devcontainer_models "code.gitea.io/gitea/models/devcontainer"

type UpdateInfo struct {
	ImageName          string `json:"ImageName"`
	PassWord           string `json:"RepositoryPassword"`
	RepositoryAddress  string `json:"RepositoryAddress"`
	RepositoryUsername string `json:"RepositoryUsername"`
	SaveMethod         string `json:"SaveMethod"`
}
type OutputResponse struct {
	CurrentJob struct {
		IP     string         `json:"ip"`
		Port   string         `json:"port"`
		Title  string         `json:"title"`
		Detail string         `json:"detail"`
		Steps  []*ViewJobStep `json:"steps"`
	} `json:"currentDevcontainer"`
}
type ViewJobStep struct {
	Summary  string            `json:"summary"`
	Duration string            `json:"duration"`
	Status   string            `json:"status"`
	Logs     []ViewStepLogLine `json:"logs"`
}

type ViewStepLogLine struct {
	Index     int64   `json:"index"`
	Message   string  `json:"message"`
	Timestamp float64 `json:"timestamp"`
}
type DevcontainerList struct {
	UserID        int64                              `json:"userId"`
	Username      string                             `json:"username"`
	DevContainers []devcontainer_models.Devcontainer `json:"devContainers"`
	Page          int                                `json:"page"`
	PageSize      int                                `json:"pageSize"`
	PageTotalNum  int                                `json:"pageTotalNum"`
	ItemTotalNum  int64                              `json:"itemTotalNum"`
}

type DevcontainerVO struct {
	DevContainerId       int64  `json:"devContainerId"       xorm:"devcontainer_id"`
	DevContainerName     string `json:"devContainerName"     xorm:"devcontainer_name"`
	DevContainerHost     string `json:"devContainerHost"     xorm:"devcontainer_host"`
	DevContainerUsername string `json:"devContainerUsername" xorm:"devcontainer_username"`
	DevContainerWorkDir  string `json:"devContainerWorkDir"  xorm:"devcontainer_work_dir"`
	UserId               int64  `json:"userId"                     xorm:"user_id"`
	RepoId               int64  `json:"repoId"                     xorm:"repo_id"`
	RepoName             string `json:"repoName"                   xorm:"repo_name"`
	//RepoOwnerID   int64  `json:"repo_owner_id"              xorm:"repo_owner_id"`
	RepoOwnerName      string `json:"repo_owner_name"            xorm:"repo_owner_name"`
	RepoLink           string `json:"repo_link"                  xorm:"repo_link"`
	RepoDescription    string `json:"repoDescription,omitempty"  xorm:"repo_description"`
	DevContainerPort   uint16 `json:"devContainerPort,omitempty"`
	DevContainerStatus uint16 `json:"devContainerStatus,omitempty" xorm:"devcontainer_status"`
}
